<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" id="but">
    <title>Document</title>
</head>
<body>
    <input type="button" value="百度">
    <img  alt="" id="img">
    <script>
        document.getElementById("but").onclick = function() {
            var img_src = document.createAttribute("src");
            img_src.value = "image/top_banner.jpg";
            var img = document.getElementById("img");
            img.setAttribute = img_src;
        }
        
    </script>
</body>
</html>